package com.iyundao.io.Service.Impl;

import com.iyundao.io.Service.ImageService;
import com.iyundao.io.mapper.ActivityImageMapper;
import com.iyundao.io.mapper.GiftImageMapper;
import com.iyundao.io.mapper.SignInImageMapper;
import com.iyundao.io.model.ActivityImage;
import com.iyundao.io.model.GiftImage;
import com.iyundao.io.model.SignInImage;
import com.iyundao.io.tools.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ImageServiceImpl implements ImageService {

    @Autowired
    private ActivityImageMapper activityImageMapper;

    @Autowired
    private GiftImageMapper giftImageMapper;

    @Autowired
    private SignInImageMapper signInImageMapper;

    @Override
    public ResponseData activityImageInsert(ActivityImage activityImage) {
        if (activityImage.toString().equals("") || activityImage.toString() == null) {
            return new ResponseData(0,"传入数据为空");
        } else {
            int i = activityImageMapper.insertSelective(activityImage);
            if (i > 0) {
                return new ResponseData(200,"添加成功");
            } else {
                return new ResponseData(0,"添加失败");
            }
        }
    }

    @Override
    public ResponseData giftImageInsert(GiftImage giftImage) {
        if (giftImage.toString().equals("") || giftImage.toString() == null) {
            return new ResponseData(0,"传入数据为空");
        } else {
            int i = giftImageMapper.insertSelective(giftImage);
            if (i > 0) {
                return new ResponseData(200,"添加成功");
            } else {
                return new ResponseData(0,"添加失败");
            }
        }
    }

    @Override
    public ResponseData signInImageInsert(SignInImage signInImage) {
        if (signInImage.toString().equals("") || signInImage.toString() == null) {
            return new ResponseData(0,"传入数据为空");
        } else {
            int i = signInImageMapper.insertSelective(signInImage);
            if (i > 0) {
                return new ResponseData(200,"添加成功");
            } else {
                return new ResponseData(0,"添加失败");
            }
        }
    }
}
